home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / Balloons.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  10.8 KB  |  312 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Balloons.h
  3.  
  4.      Contains:    Balloon Help Package Interfaces.
  5.  
  6.      Version:    Technology:    System 7.0
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1990-1993, 1995-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __BALLOONS__
  19. #define __BALLOONS__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27. #ifndef __MENUS__
  28. #include <Menus.h>
  29. #endif
  30. #ifndef __TEXTEDIT__
  31. #include <TextEdit.h>
  32. #endif
  33. #ifndef __ERRORS__
  34. #include <Errors.h>
  35. #endif
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59.  
  60. /* • constants*/
  61.  
  62.  
  63. enum {
  64.     kTopLeftTipPointsLeftVariant = 0,
  65.     kTopLeftTipPointsUpVariant    = 1,
  66.     kTopRightTipPointsUpVariant    = 2,
  67.     kTopRightTipPointsRightVariant = 3,
  68.     kBottomRightTipPointsRightVariant = 4,
  69.     kBottomRightTipPointsDownVariant = 5,
  70.     kBottomLeftTipPointsDownVariant = 6,
  71.     kBottomLeftTipPointsLeftVariant = 7,
  72.     kBalloonVariantCount        = 8
  73. };
  74.  
  75. typedef SInt16                             BalloonVariant;
  76.  
  77. enum {
  78.     hmBalloonHelpVersion        = 0x0002,                        /* The real version of the Help Manager */
  79.     kHMHelpMenuID                = -16490,                        /* Resource ID and menu ID of help menu */
  80.     kHMAboutHelpItem            = 1,                            /* help menu item number of About Balloon Help… */
  81.     kHMShowBalloonsItem            = 3,                            /* help menu item number of Show/Hide Balloons */
  82.     kHMHelpID                    = -5696,                        /* ID of various Help Mgr package resources (in Pack14 range) */
  83.     kBalloonWDEFID                = 126                            /* Resource ID of the WDEF proc used in standard balloons */
  84. };
  85.  
  86.  
  87. enum {
  88.                                                                 /* Dialog item template type constant */
  89.     helpItem                    = 1                                /* key value in DITL template that corresponds to the help item */
  90. };
  91.  
  92.  
  93. enum {
  94.                                                                 /* Options for Help Manager resources in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  95.     hmDefaultOptions            = 0,                            /* default options for help manager resources */
  96.     hmUseSubID                    = 1,                            /* treat resID's in resources as subID's of driver base ID (for Desk Accessories) */
  97.     hmAbsoluteCoords            = 2                                /* ignore window port origin and treat rectangles as absolute coords (local to window) */
  98. };
  99.  
  100.  
  101. enum {
  102.     hmSaveBitsNoWindow            = 4,                            /* don't create a window, just blast bits on screen. No update event is generated */
  103.     hmSaveBitsWindow            = 8,                            /* create a window, but restore bits behind window when window goes away & generate update event */
  104.     hmMatchInTitle                = 16                            /* for hwin resources, match string anywhere in window title string */
  105. };
  106.  
  107.  
  108. enum {
  109.                                                                 /* Constants for Help Types in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  110.     kHMStringItem                = 1,                            /* pstring used in resource */
  111.     kHMPictItem                    = 2,                            /* 'PICT' ResID used in resource */
  112.     kHMStringResItem            = 3,                            /* 'STR#' ResID & index used in resource */
  113.     kHMTEResItem                = 6,                            /* Styled Text Edit ResID used in resource ('TEXT' & 'styl') */
  114.     kHMSTRResItem                = 7,                            /* 'STR ' ResID used in resource */
  115.     kHMSkipItem                    = 256,                            /* don't display a balloon */
  116.     kHMCompareItem                = 512,                            /* Compare pstring in menu item w/ PString in resource item ('hmnu' only) */
  117.     kHMNamedResourceItem        = 1024,                            /* Use pstring in menu item to get 'STR#', 'PICT', or 'STR ' resource ('hmnu' only) */
  118.     kHMTrackCntlItem            = 2048                            /* Reserved */
  119. };
  120.  
  121.  
  122. enum {
  123.                                                                 /* Constants for hmmHelpType's when filling out HMMessageRecord */
  124.     khmmString                    = 1,                            /* help message contains a PString */
  125.     khmmPict                    = 2,                            /* help message contains a resource ID to a 'PICT' resource */
  126.     khmmStringRes                = 3,                            /* help message contains a res ID & index to a 'STR#' resource */
  127.     khmmTEHandle                = 4,                            /* help message contains a Text Edit handle */
  128.     khmmPictHandle                = 5,                            /* help message contains a Picture handle */
  129.     khmmTERes                    = 6,                            /* help message contains a res ID to 'TEXT' & 'styl' resources */
  130.     khmmSTRRes                    = 7,                            /* help message contains a res ID to a 'STR ' resource */
  131.     kHMEnabledItem                = 0                                /* item is enabled, but not checked or control value = 0 */
  132. };
  133.  
  134.  
  135. enum {
  136.                                                                 /* ResTypes for Styled TE Handles in Resources */
  137.     kHMTETextResType            = FOUR_CHAR_CODE('TEXT'),        /* Resource Type of text data for styled TE record w/o style info */
  138.     kHMTEStyleResType            = FOUR_CHAR_CODE('styl')        /* Resource Type of style information for styled TE record */
  139. };
  140.  
  141.  
  142. enum {
  143.     kHMDisabledItem                = 1,                            /* item is disabled, grayed in menus or disabled in dialogs */
  144.     kHMCheckedItem                = 2,                            /* item is enabled, and checked or control value = 1 */
  145.     kHMOtherItem                = 3,                            /* item is enabled, and control value > 1 */
  146.                                                                 /* Method parameters to pass to HMShowBalloon */
  147.     kHMRegularWindow            = 0,                            /* Create a regular window floating above all windows */
  148.     kHMSaveBitsNoWindow            = 1,                            /* Just save the bits and draw (for MDEF calls) */
  149.     kHMSaveBitsWindow            = 2                                /* Regular window, save bits behind, AND generate update event */
  150. };
  151.  
  152.  
  153. enum {
  154.                                                                 /* Resource Types for whichType parameter used when extracting 'hmnu' & 'hdlg' messages */
  155.     kHMMenuResType                = FOUR_CHAR_CODE('hmnu'),        /* ResType of help resource for supporting menus */
  156.     kHMDialogResType            = FOUR_CHAR_CODE('hdlg'),        /* ResType of help resource for supporting dialogs */
  157.     kHMWindListResType            = FOUR_CHAR_CODE('hwin'),        /* ResType of help resource for supporting windows */
  158.     kHMRectListResType            = FOUR_CHAR_CODE('hrct'),        /* ResType of help resource for rectangles in windows */
  159.     kHMOverrideResType            = FOUR_CHAR_CODE('hovr'),        /* ResType of help resource for overriding system balloons */
  160.     kHMFinderApplResType        = FOUR_CHAR_CODE('hfdr')        /* ResType of help resource for custom balloon in Finder */
  161. };
  162.  
  163. struct HMStringResType {
  164.     short                             hmmResID;
  165.     short                             hmmIndex;
  166. };
  167. typedef struct HMStringResType HMStringResType;
  168.  
  169. struct HMMessageRecord {
  170.     SInt16                             hmmHelpType;
  171.     union {
  172.         Str255                             hmmString;
  173.         SInt16                             hmmPict;
  174.         TEHandle                         hmmTEHandle;
  175.         HMStringResType                 hmmStringRes;
  176.         SInt16                             hmmPictRes;
  177.         PicHandle                         hmmPictHandle;
  178.         SInt16                             hmmTERes;
  179.         SInt16                             hmmSTRRes;
  180.     }                                 u;
  181. };
  182. typedef struct HMMessageRecord HMMessageRecord;
  183.  
  184. typedef HMMessageRecord *                HMMessageRecPtr;
  185. typedef CALLBACK_API( OSErr , TipFunctionProcPtr )(Point tip, RgnHandle structure, Rect *r, BalloonVariant *balloonVariant);
  186. typedef STACK_UPP_TYPE(TipFunctionProcPtr)                         TipFunctionUPP;
  187. enum { uppTipFunctionProcInfo = 0x00003FE0 };                     /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  188. #define NewTipFunctionProc(userRoutine)                         (TipFunctionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTipFunctionProcInfo, GetCurrentArchitecture())
  189. #define CallTipFunctionProc(userRoutine, tip, structure, r, balloonVariant)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppTipFunctionProcInfo, (tip), (structure), (r), (balloonVariant))
  190. /*  Public Interfaces  */
  191. EXTERN_API( OSErr )
  192. HMGetHelpMenuHandle                (MenuHandle *            mh)                                    THREEWORDINLINE(0x303C, 0x0200, 0xA830);
  193.  
  194. EXTERN_API( OSErr )
  195. HMShowBalloon                    (const HMMessageRecord * inHelpMessage,
  196.                                  Point                     inTip,
  197.                                  Rect *                    inHotRect,
  198.                                  TipFunctionUPP         inTipProc,
  199.                                  SInt16                 inWindowProcID,
  200.                                  BalloonVariant         inBalloonVariant,
  201.                                  SInt16                 inMethod)                            THREEWORDINLINE(0x303C, 0x0B01, 0xA830);
  202.  
  203. EXTERN_API( OSErr )
  204. HMShowMenuBalloon                (SInt16                 itemNum,
  205.                                  SInt16                 itemMenuID,
  206.                                  SInt32                 itemFlags,
  207.                                  SInt32                 itemReserved,
  208.                                  Point                     tip,
  209.                                  RectPtr                 alternateRect,
  210.                                  TipFunctionUPP         tipProc,
  211.                                  SInt16                 theProc,
  212.                                  BalloonVariant         balloonVariant)                        THREEWORDINLINE(0x303C, 0x0E05, 0xA830);
  213.  
  214. EXTERN_API( OSErr )
  215. HMRemoveBalloon                    (void)                                                        THREEWORDINLINE(0x303C, 0x0002, 0xA830);
  216.  
  217. EXTERN_API( OSErr )
  218. HMGetIndHelpMsg                    (ResType                 inWhichResType,
  219.                                  SInt16                 inWhichResID,
  220.                                  SInt16                 inMessageIndex,
  221.                                  SInt16                 inMessageState,
  222.                                  UInt32 *                outOptions,
  223.                                  Point *                outTip,
  224.                                  Rect *                    outHotRect,
  225.                                  SInt16 *                outWindowProcID,
  226.                                  BalloonVariant *        outBalloonVariant,
  227.                                  HMMessageRecord *        outHelpMessage,
  228.                                  SInt16 *                outMessageCount)                    THREEWORDINLINE(0x303C, 0x1306, 0xA830);
  229.  
  230. EXTERN_API( Boolean )
  231. HMIsBalloon                        (void)                                                        THREEWORDINLINE(0x303C, 0x0007, 0xA830);
  232.  
  233. EXTERN_API( Boolean )
  234. HMGetBalloons                    (void)                                                        THREEWORDINLINE(0x303C, 0x0003, 0xA830);
  235.  
  236. EXTERN_API( OSErr )
  237. HMSetBalloons                    (Boolean                 flag)                                THREEWORDINLINE(0x303C, 0x0104, 0xA830);
  238.  
  239. EXTERN_API( OSErr )
  240. HMSetFont                        (SInt16                 font)                                THREEWORDINLINE(0x303C, 0x0108, 0xA830);
  241.  
  242. EXTERN_API( OSErr )
  243. HMSetFontSize                    (UInt16                 fontSize)                            THREEWORDINLINE(0x303C, 0x0109, 0xA830);
  244.  
  245. EXTERN_API( OSErr )
  246. HMGetFont                        (SInt16 *                font)                                THREEWORDINLINE(0x303C, 0x020A, 0xA830);
  247.  
  248. EXTERN_API( OSErr )
  249. HMGetFontSize                    (UInt16 *                fontSize)                            THREEWORDINLINE(0x303C, 0x020B, 0xA830);
  250.  
  251. EXTERN_API( OSErr )
  252. HMSetDialogResID                (SInt16                 resID)                                THREEWORDINLINE(0x303C, 0x010C, 0xA830);
  253.  
  254. EXTERN_API( OSErr )
  255. HMSetMenuResID                    (SInt16                 menuID,
  256.                                  SInt16                 resID)                                THREEWORDINLINE(0x303C, 0x020D, 0xA830);
  257.  
  258. EXTERN_API( OSErr )
  259. HMBalloonRect                    (const HMMessageRecord * inMessage,
  260.                                  Rect *                    outRect)                            THREEWORDINLINE(0x303C, 0x040E, 0xA830);
  261.  
  262. EXTERN_API( OSErr )
  263. HMBalloonPict                    (const HMMessageRecord * inMessage,
  264.                                  PicHandle *            outPict)                            THREEWORDINLINE(0x303C, 0x040F, 0xA830);
  265.  
  266. EXTERN_API( OSErr )
  267. HMScanTemplateItems                (SInt16                 whichID,
  268.                                  SInt16                 whichResFile,
  269.                                  ResType                 whichType)                            THREEWORDINLINE(0x303C, 0x0410, 0xA830);
  270.  
  271. EXTERN_API( OSErr )
  272. HMExtractHelpMsg                (ResType                 inType,
  273.                                  SInt16                 inResID,
  274.                                  SInt16                 inMessageIndex,
  275.                                  SInt16                 inMessageState,
  276.                                  HMMessageRecord *        outMessage)                            THREEWORDINLINE(0x303C, 0x0711, 0xA830);
  277.  
  278. EXTERN_API( OSErr )
  279. HMGetDialogResID                (SInt16 *                resID)                                THREEWORDINLINE(0x303C, 0x0213, 0xA830);
  280.  
  281. EXTERN_API( OSErr )
  282. HMGetMenuResID                    (SInt16                 menuID,
  283.                                  SInt16 *                resID)                                THREEWORDINLINE(0x303C, 0x0314, 0xA830);
  284.  
  285. EXTERN_API( OSErr )
  286. HMGetBalloonWindow                (WindowPtr *            window)                                THREEWORDINLINE(0x303C, 0x0215, 0xA830);
  287.  
  288.  
  289.  
  290.  
  291.  
  292. #if PRAGMA_STRUCT_ALIGN
  293.     #pragma options align=reset
  294. #elif PRAGMA_STRUCT_PACKPUSH
  295.     #pragma pack(pop)
  296. #elif PRAGMA_STRUCT_PACK
  297.     #pragma pack()
  298. #endif
  299.  
  300. #ifdef PRAGMA_IMPORT_OFF
  301. #pragma import off
  302. #elif PRAGMA_IMPORT
  303. #pragma import reset
  304. #endif
  305.  
  306. #ifdef __cplusplus
  307. }
  308. #endif
  309.  
  310. #endif /* __BALLOONS__ */
  311.  
  312.